package com.googlecode.KeepInTouch;

public class ContactSummary {
	public long id;
	public String lookupKey;
	public int calls;
	public long durationSum;
	public long lastCallDate;
	public int incomingCalls;
	public long incomingSum;
	public long lastIncomingCall;
	public int outgoingCalls;
	public long outgoingSum;
	public long lastOutgoingCall;
	public int missedCalls;
	public long lastMissedCall;
	
	public void merge(ContactSummary summary) {
		this.calls += summary.calls;
		this.durationSum += summary.durationSum;
		this.lastCallDate = (this.lastCallDate >= summary.lastCallDate)? this.lastCallDate : summary.lastCallDate;
		this.incomingCalls += summary.incomingCalls;
		this.incomingSum += summary.incomingSum;
		this.lastIncomingCall = (this.lastIncomingCall >= summary.lastIncomingCall)? this.lastIncomingCall : summary.lastIncomingCall;
		this.outgoingCalls += summary.outgoingCalls;
		this.outgoingSum += summary.outgoingSum;
		this.lastOutgoingCall = (this.lastOutgoingCall >= summary.lastOutgoingCall)? this.lastOutgoingCall : summary.lastOutgoingCall;
		this.missedCalls += summary.missedCalls;
		this.lastMissedCall = (this.lastMissedCall >= summary.lastMissedCall)? this.lastMissedCall : summary.lastMissedCall;
	}
}
